package cn.edu.tju.elm.mapper;

import cn.edu.tju.elm.dto.OrderDetailetResponseDTO;
import cn.edu.tju.elm.dto.OrderResponseDTO;
import cn.edu.tju.elm.model.Order;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.lang.annotation.Target;
import java.util.List;

/**
* ClassName: OrderMapper
* Package: cn.edu.tju.elm.mapper
* Description: 
* @Author Niu Wenhang
* @Create 2025/9/18 23:49 
* @Version 1.0 
*
* @Author Liu Wenrui
* @Create 2025/9/26 10:00
* @Version 1.1
*/
@Mapper(componentModel = "spring")
public interface OrderMapper {
    @Mapping(target = "customerId", source = "customer.id")
    @Mapping(target = "businessId", source = "business.id")
    @Mapping(target = "addressId", source = "deliveryAddress.id")
    @Mapping(target = "orderDetailetList", source = "orderDetailets")
    OrderResponseDTO toOrderResponseDTO(Order order);

    List<OrderResponseDTO> toOrderResponseDTOs(List<Order> orders);

}
